
let registerVue = new Vue({
  el: "#register",
  data() {
    return {
      registerForm:{
        username:'',
        password:'',
        repass:'',
        email:'',
        emailCode:''
      }
    }
  },
  methods: {
    getEmail(){
      if(this.registerForm.email.length<1){
        alert("请输入邮箱地址")
        return;
      }

      axios.postForm("/user/requestEmailCode",{email:this.registerForm.email})
          .then( (response) => {
            let responseData = response.data;
            if (responseData=="ok"){
              alert("验证码发送成功")
            }else {
              alert(responseData)
            }
          } )
    },
    registerUser(){
        axios.postForm("/user/register",this.registerForm)
          .then(response => {
            let responseData = response.data;
            if (responseData=="ok"){
              alert("注册成功")
            }else {
              alert(responseData)
            }
          })
    }

  },
  created() {
    console.log("registerVue 对象创建完成了")

  }

});